//
//  HHBaseTableViewReusableView.m
//  ZHUIKit
//
//  Created by Basic on 2019/9/6.
//

#import "HHBaseTableViewReusableView.h"
#import <BCComConfigKit/BCComConfigKit.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#import <Masonry/Masonry.h>
#pragma clang diagnostic pop
#import <BCUIKit/UIButton+BCHelper.h>
#import <BCFoundation/BCFoundationUtils.h>

@interface HHBaseTableViewReusableView()
/// 头部的图片，访问属性自动生成
@property (nonatomic, strong, readwrite) UIImageView *headerImgv;
@property (nonatomic, strong, readwrite) UIImageView *iconImgv;
/// 标题 label，访问属性自动生成
@property (nonatomic, strong, readwrite) UILabel *titleLab;
/// 描述 label，访问属性自动生成
@property (nonatomic, strong, readwrite) UILabel *detailLab;
@property (nonatomic, strong, readwrite) UILabel *topSplitLab;
@property (nonatomic, strong, readwrite) UILabel *bottomSplitLab;
@property (nonatomic, strong, readwrite) UIButton *arrowBtn;
@end

@implementation HHBaseTableViewReusableView
//MARK: - life cycle
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupSubviews];
    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self setupSubviews];
    }
    return self;
}

//MARK: - 初始化
- (void)setupSubviews {
    if (_titleLab.superview) {
        return;
    }
    [self.contentView addSubview:self.titleLab];
}

//MARK: - getter
-(UIImageView *)headerImgv {
    if (!_headerImgv) {
        _headerImgv = [[UIImageView alloc] init];
        [self.contentView addSubview:_headerImgv];
        [_headerImgv mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(15);
        }];
    }
    return _headerImgv;
}
-(UIImageView *)iconImgv {
    if (!_iconImgv) {
        _iconImgv = [[UIImageView alloc] init];
        [self.contentView addSubview:_iconImgv];
        [_iconImgv mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(30);
        }];
    }
    return _iconImgv;
}
-(UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = BCComConfig.shared.bcFont(15);
        _titleLab.textColor = BCComConfig.shared.blackColor;
        [self.contentView addSubview:_titleLab];
    }
    return _titleLab;
}
-(UILabel *)detailLab {
    if (!_detailLab) {
        _detailLab = [[UILabel alloc] init];
        _detailLab.font = BCComConfig.shared.bcFont(15);
        _detailLab.textColor = BCComConfig.shared.lightBlackColor;
        [self.contentView addSubview:_detailLab];
    }
    return _detailLab;
}
-(UILabel *)topSplitLab {
    if (!_topSplitLab) {
        _topSplitLab = [[UILabel alloc] init];
        _topSplitLab.backgroundColor = BCComConfig.shared.splitColor;
        [self.contentView addSubview:_topSplitLab];
        [_topSplitLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(0);
            make.right.mas_equalTo(0);
            make.top.mas_equalTo(0);
            make.height.mas_equalTo(1);
        }];
    }
    return _topSplitLab;
}
-(UILabel *)bottomSplitLab {
    if (!_bottomSplitLab) {
        _bottomSplitLab = [[UILabel alloc] init];
        _bottomSplitLab.backgroundColor = BCComConfig.shared.splitColor;
        [self.contentView addSubview:_bottomSplitLab];
        [_bottomSplitLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(0);
            make.right.mas_equalTo(0);
            make.bottom.mas_equalTo(0);
            make.height.mas_equalTo(1);
        }];
    }
    return _bottomSplitLab;
}
@end
